<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <title>确认收款</title>
    <meta name="keywords" content="知果汇"/>
    <meta name="description" content="知果汇"/>
    <link rel="SHORTCUT ICON" href="images/favicon.ico"/>
    <link rel="stylesheet" type="text/css" href="_CSS_/reset.css">
    <link rel="stylesheet" type="text/css" href="_CSS_/common.css">
    <link rel="stylesheet" type="text/css" href="_CSS_/store_center.css"/>
    <style type="text/css">
        html, body {
            width: 570px;
            min-width: 570px;
        }

        form {
            width: 540px;
            padding: 20px;
        }

        .formItem {
            overflow: hidden;
        }

        .formItem label {
            font-size: 14px;
            color: #333333;
        }

        .products {
            overflow: hidden;
            width: 470px;
        }

        .products img {
            width: 120px;
            height: 120px;
            float: left;
        }

        .products p {
            width: 340px;
            display: inline-block;
            float: left;
            padding-left: 10px;
            margin-bottom: 15px;
        }

        .productName {
            font-size: 14px;
            color: #333333;
        }

        .greyTag {
            color: #999999;
            font-size: 12px;
            width: 70px;
            display: inline-block;
        }

        .types, .mode {
            font-size: 11px;
            color: #333333;
        }

        .priceNum {
            font-size: 14px;
            color: #FF4900;
        }

        .fillin {
            border: 1px solid #E5E5E5;
            height: 34px;
            line-height: 34px;
            font-size: 14px;
            color: #999999;
            width: 428px;
            padding: 0 10px;
        }

        .commentsFill {
            font-size: 14px;
            text-indent: 0;
        }

        .btn-box {
            width: 570px;
            text-align: center;
            margin-top: 20px;
        }

        .btn-box a {
            display: inline-block;
            height: 37px;
            line-height: 37px;
            margin: 5px 25px 0;
            padding: 0 30px;
            border: 1px solid #dedede;
            background-color: #fff;
            color: #333;
            border-radius: 5px;
            font-weight: 400;
            cursor: pointer;
            text-decoration: none;
            font-size: 14px;
        }

        .btn-box .btn-n1 {
            border-color: #3377c0;
            background-color: #3377c0;
            color: #ffffff;
        }

        .con-p {
            font-size: 16px;
            color: #333333;
        }

        .con-pl {
            font-size: 14px;
        }
    </style>
</head>
<body>
<form action="" method="post">
    <div class="formItem">
        <div class="products fl" name="products">
            <img class="name" src="" alt=""/>
            <p class="productName name"></p>
            <p class="prices priceNum"><span class="greyTag">价格</span><span class="priceNum"></span></p>
            <p class="mode"><span class="greyTag">交易方式</span><span class="serviceType name"></span></p>
            <p class="types"><span class="greyTag">类型</span><span class="productType">交易类商品</span></p>
        </div>
    </div>
    <p class="con-p con-pl name"></p>
    <p class="con-p">确认收到钱款了吗？</p>
    <div class="btn-box">
        <a class="btn-n1" href="#" title="确认" onclick="confirm()">确认</a>
        <a class="btn-n2" href="#" title="取消" onclick="cancel()">取消</a>
    </div>
</form>
</body>
<script src="_JS_/jquery-1.8.3.min.js"></script>
<script src="_JS_/jquery.base64.js"></script>
<script src="_JS_/jquery.cookie.js"></script>
<script src="_JS_/common.js"></script>
<script src="_P_/layer/layer.js"></script>
<script type="text/javascript">
    var url = window.location.href;
    var id = url.split("#")[1];
    var king = url.split("#")[2];
    var all = url.split("#")[3];

    if (king == '') {
        king = 1;
    }

    if (all == '') {
        all = 0;
    }

    $(function () {
        getfile();
    });

    function getfile() {

        $.ajax({
            type: "get",
            url: "/index.php/api/shop/confirmation_receivables_get",
            data: {id: id},
            dataType: 'jsonp',
            jsonp: 'callback',
            success: function (msg) {
                if (msg.code == 200) {
                    $(".name").eq(0).attr('src', '/Images/tradingMarket/' + msg.data.image);
                    $(".name").eq(0).val(msg.data.image);
                    $(".name").eq(1).html(msg.data.username);
					var store = number_format(msg.data.store, 2, ".", ",");
                    $(".prices").html("￥" + store);
                    $(".name").eq(2).html(msg.data.trading_name);
                    $(".name").eq(3).html("商家支付宝账号：" + msg.data.alipay);
                }
                if (msg.code == 1000) {
                    layer.msg('查询失败！', {icon: 5});
                }
            }
        });
    }


    //确认
    function confirm(obj) {
        var userinfo = $.cookie('userinfo');
        if (userinfo != null) {
            var user_login = $.base64.decode(userinfo).split(",");
            $.ajax({
                type: "get",
                url: "/index.php/api/shop/confirmation_receivables_post",
                data: {id: id},
                dataType: 'jsonp',
                jsonp: 'callback',
				beforeSend: function () {
                var index = layer.load(1, {
                    shade: [0.1, '#333333'] //0.1透明度的白色背景
                });
				},
                success: function (msg) {
					layer.closeAll();
                    if (msg.code == 200) {
                        parent.postfile(1, king, all);
                        var index = parent.layer.getFrameIndex(window.name);
                        parent.layer.close(index);
                    }
                    if (msg.code == 1000) {
                        layer.msg('添加失败！', {icon: 5});
                    }
                }
            });
        } else {
            window.location.href = "{:url('index/login/index')}";
        }
    }

    //取消
    function cancel(obj) {
        var index = parent.layer.getFrameIndex(window.name);
        parent.layer.close(index);
    }
</script>
</html>
